package com.zuoye.day08;


public class SplitOrder{


    public static Order[] split(Order order) {

    int newLength = (int) ( Math.ceil((double)order.getProductCount()/1000) );
        Order[] orders= new Order[ newLength ];
        int count = 0;
        while (order.orderNum > 1000) {
            Order subOrder = order.orderClone();
            subOrder.setOrderNum(1000);
            order.setOrderNum(order.orderNum - 1000);
            orders[count++]  = subOrder;
        }
        orders[count] = order;

        return orders;


    }




}

